<script  type="text/javascript">
$(document).ready(function() {

	// Validating Form Fields.....
	$("#submit").click(function(e) {
		var kirim_ke = $("#kirim_ke").val();
		if (kirim_ke == '') {
			alert("Please fill all fields...!!!!!!");
			e.preventDefault();
		}{
			$.ajax({
				url: '<?php echo base_url();?>surat_keluar/proses_kirim',
				type: 'post',
				data: $('#form_kirim').serialize(),
			})
			.done(function() {
				console.log("success");
				$('#show_kirim').dialog('close');
				var url = "<?php echo base_url()?>surat_keluar";
				$(location).attr('href',url);
			})
			.fail(function() {
				console.log("error");
			})
			.always(function() {
				console.log("complete");
			});
		}




	});
});

</script>


<form action="" name="form_kirim" id="form_kirim" method="post" accept-charset="utf-8">
	<input type="hidden" name="gen_log_surat" value="<?php echo $datpil->gen_log_surat; ?>">
	<input type="hidden" name="idp" value="<?php echo $datpil->id_log; ?>">
	<select name="kirim_ke" class="form-control">
			<?php
				$d['value'] = $kirim_ke;
				echo $this->mdl_reff_unit->get_user_reff_unit($d);
			?>

		</select>
		<input type="button" id="submit" value="Simpan">

</form>